/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.business.domain;

import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions;
import me.zhengjie.base.BaseBusiness;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.*;
import javax.validation.constraints.*;
import java.sql.Timestamp;
import java.io.Serializable;
import java.util.Objects;

/**
* @website https://el-admin.vip
* @description /
* @author xiahongbo
* @date 2022-07-24
**/
@Entity
@Data
@Table(name="BIS_ZHSQ_HISTORY")
public class ZhsqHistory extends BaseBusiness implements Serializable {

    @Id
    @GenericGenerator(name = "hibernate-uuid", strategy = "uuid")
    @GeneratedValue(generator = "hibernate-uuid")
    @Column(name = "ID")
    @ApiModelProperty(value = "主键")
    private String id;

    @Column(name = "USER_ID")
    @ApiModelProperty(value = "用户ID")
    private Long userId;

    @Column(name = "ZHSQ_ID")
    @ApiModelProperty(value = "照护ID")
    private Long zhsqId;

    @Column(name = "RESULT")
    @ApiModelProperty(value = "操作结果")
    private String result;

    @Column(name = "TYPE")
    @ApiModelProperty(value = "操作类型")
    private String type;

    @Column(name = "BZ")
    @ApiModelProperty(value = "备注")
    private String bz;

    @OneToOne
    @JoinColumn(name="ZHSQ_ID",referencedColumnName="BIS_ZHSQ_ID",insertable = false,updatable = false)
    private Zhsq zhsq;

    public void copy(ZhsqHistory source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
    @Override
    public int hashCode() {
        return Objects.hash(id, userId, zhsqId);
    }
}